
<?php  $this->beginBlock('css'); ?>
<link rel="stylesheet" type="text/css" href="<?=Yii::getAlias('@static')?>/wap/liketry/css/goods.css">
<?php $this->endBlock();?>

<header>
  <div class="header-left" onclick="$.go('<?=Yii::$app->urlManager->createUrl(['category/index'])?>');"><span class="icon icon-arrow-left"></span></div>
  <h1>商品列表</h1>
  <div class="header-right" onclick="$.go('<?=Yii::$app->urlManager->createUrl(['index'])?>');" ><span class="icon icon-home"></span></div>
</header>

<!---选择排序开始 -->
<div class="sort-menu" id="sort-menu">
    <div class="box">
        <div class="flex1 sortBtn hot <?php echo ($sort_type==1)?strtolower((isset($_GET['sort'])?$_GET['sort']:'desc')):''; ?>"  data-id="1"><a href="<?=Yii::$app->urlManager->createUrl(['goods-list/index','sort_type'=>'1','sort'=>($sort_type==1)?$rorder:'DESC','cate_id'=>(isset($_GET['cate_id'])?$_GET['cate_id']:1)]);?>">热销</a></div>
        <div class="flex1 sortBtn price <?php echo ($sort_type==2)?strtolower($_GET['sort']):''?>" data-id="2"><a href="<?=Yii::$app->urlManager->createUrl(['goods-list/index','sort_type'=>'2','sort'=>($sort_type==2)?$rorder:'DESC','cate_id'=>(isset($_GET['cate_id'])?$_GET['cate_id']:1)]);?>">价格</a></div>
        <!--<div class="flex1 sortBtn try <?php echo ($sort_type==3)?strtolower($_GET['sort']):''?>" data-id="3"><a href="<?=Yii::$app->urlManager->createUrl(['goods-list/index','sort_type'=>'3','sort'=>($sort_type==3)?$rorder:'DESC','cate_id'=>(isset($_GET['cate_id'])?$_GET['cate_id']:1)]);?>">试豆</a></div>-->
        <div class="flex1 sortBtn new <?php echo ($sort_type==4)?strtolower($_GET['sort']):''?> " data-id="4"><a href="<?=Yii::$app->urlManager->createUrl(['goods-list/index','sort_type'=>'4','sort'=>($sort_type==4)?$rorder:'DESC','cate_id'=>(isset($_GET['cate_id'])?$_GET['cate_id']:1)]);?>">最新</a></div>
    </div>
</div>

<input type="hidden" id="sortType" name="sort_type" value="<?php echo !empty($_GET['sort_type'])?$_GET['sort_type']:''?>">
<input type="hidden" id="pageNum" name="page_num" value="<?php echo !empty($_GET['page_num'])?$_GET['page_num']:''?>">
<input type="hidden" id="cateId" name="cate_id" value="<?php echo !empty($_GET['cate_id'])?$_GET['cate_id']:1?>">
<input type="hidden" id="sort" name="sort" value="<?php echo !empty($_GET['sort'])?$_GET['sort']:''?>">
<!---选择排序结束-->
<!---商品列表开始 -->
<?php if(!empty($goods_info)):?>
    <ul class="goods-list" id="goodsList">
        <?php foreach($goods_info as $k=>$v):?>
            <li>
                <a href="<?=Yii::$app->urlManager->createUrl(['goods-detail/index','product_id'=>$v['default_sku']]);?>">
                    <div class="img"><img src="<?php echo \Yii::$app->params['goods_image_url'] . str_replace('./upload/', 'upload/',$v['pic']);?>"></div>
                    <div class="content">
                        <p class="title"><?=$v['goods_name']?></p>
                        <!--购买价格-->
                        <?php if(isset($v['sale_price_type'])):?>
                            <p class="price"><span>价&nbsp;&nbsp;&nbsp;&nbsp;格：</span><em><?=isset($v['sale_price'])?$v['sale_price']:""?><?php echo $v['sale_price_type']?"试豆":"元"?></em></p>
                        <?php endif ;?>
                        <!--试用价格-->
                        <?php if(isset($v['try_price_type'])):?>
                            <p class="try-price"><span>试用价：</span><em><?=isset($v['try_price'])?$v['try_price']:""?><?php echo $v['try_price_type']?"试豆":"元"?></em></p>
                        <?php endif ?>
                        <p class="comment"><?=$v['comment']?>条评论</p>
                    </div>
                </a>
            </li>
        <?php endforeach;?>
    </ul>
    <!----商品列表结束-->
<?php else: ?>
   <div class="nolist"> 没有符合搜索条件的商品</div>
<?php endif ?>


<div class="fixed-right">
    <?php
    if($bestry_uid){
        ?>
        <?php if($cart_num>0&&$cart_num<100){?>
            <div class="cart"><a href="<?=Yii::$app->urlManager->createUrl(["cart"]);?>">
                <p style="display:block"><?php echo $cart_num;?></p>
            </a></div>
        <?php }else if($cart_num>99){?>
            <div class="cart"><a href="<?=Yii::$app->urlManager->createUrl(["cart"]);?>">
                <p style="display:block">99+</p>
            </a></div>
        <?php }elseif ($cart_num<1) {?>
            <div class="cart"><a href="<?=Yii::$app->urlManager->createUrl(["cart"]);?>">
                <p style="display:none"></p>
            </a></div>
        <?php }?>
    <?php }else{?>
        <div class="cart"><a href="<?php echo $login_url; ?>" >
            <p style="display:none"></p>
        </a></div>
   <?php }?>
    <div class="back-top" id="backTop"></div>
</div>

<script src="<?=Yii::getAlias('@static')?>/wap/common/js/zepto.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/wap/common/js/fastclick.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/wap/common/js/king.wap.js"></script>
<script src="<?=Yii::getAlias('@static')?>/wap/liketry/js/goods_list.js"></script>
<script>
    var goodsListUrl="<?=Yii::$app->urlManager->createUrl(['goods-list/ajax_page']);?>";
</script>

